package com.oristartech.ori.common.generater.test;

import com.oristartech.ori.common.generater.DBGeneraterAbstract;
import com.oristartech.ori.common.generater.Table;

import java.sql.SQLException;

public class CtmDBGenerater extends DBGeneraterAbstract {
    // 开发数据配置
    private static final String IP_ADDRESS = "rm-8vb7s52v8a502z2i120800.mysql.zhangbei.rds.aliyuncs.com";
    private static final String TABLE_SCHEM = "CTM";
    private static final String USER_NAME = "ctm";
    private static final String PASSWORD = "bd4ss9i0vWSs5ktx";
    private static final String TENANT_ID = "321566";
    private static final String CINEMA_ID = "";
    private static final String PROJECT_BASE_PACKAGE_NAME = "com.oristartech.ctm";
    private static final String PROJECT_ROOT_DIRECTORY = "E:\\code\\ctm\\ctm-service";
    private static final String PROJECT_ENTITY_DIRECTORY = "E:\\code\\ctm\\ctm-api";
    private static final String FREEMARK_TEMPLATE_DIRECTORY = "E:\\dadi_project\\OristarTicketingSystem\\ori\\ori-common-mybatis\\src\\main\\resources\\templates";

    private static final String[] GENERATE_TABLE_NAME_OR_PREFIX = new String[]{"ci_price_tickettype_321566"};
    private static final boolean IS_GENERATE_ENTITY = true;
    private static final boolean IS_GENERATE_BASE_MAPPER = true;
    private static final boolean IS_GENERATE_MAPPER = false;
    private static final boolean IS_GENERATE_SERVICE = false;
    private static final boolean IS_GENERATE_FACADE = false;

    public static void main(String[] args) throws SQLException, ClassNotFoundException {
        CtmDBGenerater generater = new CtmDBGenerater();
        generater.generate();
    }

    // 获取数据IP地址
    public String getDatabaseIPAddress() {
        return IP_ADDRESS;
    }

    // 获取数据库名
    public String getDatabaseName() {
        return TABLE_SCHEM;
    }

    // 获取数据库用户名
    public String getDatabaseUserName() {
        return USER_NAME;
    }

    // 获取数据库密码
    public String getDatabasePassword() {
        return PASSWORD;
    }

    // 获取租户ID，即表后缀
    public String getTableTenantId() {
        return TENANT_ID;
    }

    // 获取影院ID，即表后缀
    public String getTableCinemaId() {
        return CINEMA_ID;
    }

    // 获取项目工程基础包名
    public String getProjectBasePackageName() {
        return PROJECT_BASE_PACKAGE_NAME;
    }

    // 获取项目工程根目录
    public String getProjectRootDirectory() {
        if (PROJECT_ROOT_DIRECTORY.endsWith(Table.DIRECTORY_FILE_SEPARATOR)) {
            return PROJECT_ROOT_DIRECTORY;
        }
        return PROJECT_ROOT_DIRECTORY.concat(Table.DIRECTORY_FILE_SEPARATOR);
    }

    // 获取项目工程实体类目录
    public String getProjectEntityDirectory() {
        if (PROJECT_ENTITY_DIRECTORY.endsWith(Table.DIRECTORY_FILE_SEPARATOR)) {
            return PROJECT_ENTITY_DIRECTORY;
        }
        return PROJECT_ENTITY_DIRECTORY.concat(Table.DIRECTORY_FILE_SEPARATOR);
    }

    // 获取要生成的表名或表名前缀
    public String[] getGenerateTableNameOrPrefix() {
        return GENERATE_TABLE_NAME_OR_PREFIX;
    }

    // 获取模板目录
    public String getFreemarkTemplateDirectory() {
        return FREEMARK_TEMPLATE_DIRECTORY;
    }

    // 是否重新生成Entity
    public boolean isGenerateEntity() {
        return IS_GENERATE_ENTITY;
    }

    // 是否重新生成BaseMapper
    public boolean isGenerateBaseMapper() {
        return IS_GENERATE_BASE_MAPPER;
    }

    // 是否重新生成BaseMapperXml
    public boolean isGenerateBaseMapperXml() {
        return IS_GENERATE_BASE_MAPPER;
    }

    // 是否重新生成Mapper
    public boolean isGenerateMapper() {
        return IS_GENERATE_MAPPER;
    }

    // 是否重新生成MapperXml
    public boolean isGenerateMapperXml() {
        return IS_GENERATE_MAPPER;
    }

    // 是否重新生成Service
    public boolean isGenerateService() {
        return IS_GENERATE_SERVICE;
    }

    // 是否重新生成ServiceImpl
    public boolean isGenerateServiceImpl() {
        return IS_GENERATE_SERVICE;
    }

    // 是否重新生成Facade
    public boolean isGenerateFacade() {
        return IS_GENERATE_FACADE;
    }

    // 是否重新生成FacadeImpl
    public boolean isGenerateFacadeImpl() {
        return IS_GENERATE_FACADE;
    }

}
